package com.nulldev.util.threading.v3_extensions;

interface _Task<T> {

	/**
	 * DO NOT RUN. <br>
	 * See: <code>Task.run()</code>
	 */
	public T _run();
	
	/**
	 * Freezes the current thread until either the following occur: <br>
	 * - The task completes and returns the result. <br>
	 * - The task fails, is killed and NULL is returned.
	 */
	public T waitTillCompletion();
	
	/**
	 * Gets the status of the task.
	 * @returns TaskStatus
	 */
	public TaskStatus status();
	
	/**
	 * Returns true if the task has executed successfully.
	 * @returns Boolean <br>
	 * Internal value: <code>return (this.status == TaskStatus.COMPLETED);</code>
	 */
	public boolean completed();
	
	/**
	 * Returns the current item
	 * @returns Currently held item. <br>
	 * WARNING: This item may be <code>NULL</code> if not completed
	 */
	public T result();
}
